﻿using Newtonsoft.Json;
using RestSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace TheAPI
{
    public abstract class Module
    {
        internal RiotGamesAPI API { get; set; }

        public Module(RiotGamesAPI api)
        {
            API = api;
        }

        internal T REST<T>(RestRequest request)
        {
            var client = new RestClient("http://prod.api.pvp.net");
            var response = client.Execute(request);
            try
            {
                return JsonConvert.DeserializeObject<T>(response.Content);
            }
            catch
            {
                return default(T);
            }
        }
    }
}
